﻿@model IEnumerable<BskLeague.Models.Stadium>

@{
    ViewBag.Title = "Stadiony :: Lista";
}

<h2>Stadiony</h2>

@if (User.IsInRole("Admin"))
{
    <p>
        <a href='@Url.Action("New")'>
            <img src="../../Content/images/new-icon.png" alt="nowy" />
        </a>
    </p>
}

<table class="stadium_list_table">
    <tr>
        <th>Nazwa</th>
        <th>Ulica</th>
        <th>Miasto</th>
        <th></th>
    </tr>
    @foreach (var stadium in Model)
    {
        <tr>
            <td>@Html.ActionLink(@stadium.stadiumName, "Details", new { id = @stadium.stadiumId })</td>
            <td>@stadium.stadiumAddressStreet</td>
            <td>@stadium.stadiumAddressCity</td>
            <td>
                @if (User.IsInRole("Admin"))
                {
                    <a href='@Url.Action("Edit", new { id = @stadium.stadiumId })'>
                        <img src='../../Content/images/edit-icon.png' title='edytuj' alt='edytuj' />
                    </a>
                    <a href="javascript:if(confirm('Na pewno usunąć?')){window.location='/Stadium/Delete/@stadium.stadiumId'}">
                        <img src='../../Content/images/delete-icon.png' title='usuń' alt='usuń' />
                    </a>
                }
            </td>
        </tr>
    }
</table>